package org.walkframework.sample.business.sample.infra.dataobject;

import java.util.Date;

import org.walkframework.boot.ehdb.bean.BaseBean;
import org.walkframework.boot.ehdb.annotation.*;

/**
 * 基于表walk_sample自动生成的JavaBean 示例表
 *
 * @since  [2024/04/09]
 * @author weisheng
 */
@Table("WALK_SAMPLE")
public class Sample extends BaseBean {

	public Sample(){
		super();
		addPrimaryKey(Columns.ID);
	}

	/**
	 * 主键
	 */
	@IdGenerator
	@Column(Columns.ID)
	private Long id;

	/**
	 * 名称
	 */
	@Column(Columns.NAME)
	private String name;

	/**
	 * 描述
	 */
	@Column(Columns.DESCRIPTION)
	private String description;

	/**
	 * 是否已删除
	 */
	@Column(Columns.IS_DELETED)
	private Boolean isDeleted;

	/**
	 * 创建时间
	 */
	@Column(Columns.CREATE_TIME)
	private Date createTime;

	/**
	 * 创建人
	 */
	@Column(Columns.CREATOR)
	private String creator;

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
		recordUpdated(Columns.ID);
	}

	public Sample letId(Long id) {
		setId(id);
		return this;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
		recordUpdated(Columns.NAME);
	}

	public Sample letName(String name) {
		setName(name);
		return this;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
		recordUpdated(Columns.DESCRIPTION);
	}

	public Sample letDescription(String description) {
		setDescription(description);
		return this;
	}

	public Boolean getIsDeleted() {
		return this.isDeleted;
	}

	public void setIsDeleted(Boolean isDeleted) {
		this.isDeleted = isDeleted;
		recordUpdated(Columns.IS_DELETED);
	}

	public Sample letIsDeleted(Boolean isDeleted) {
		setIsDeleted(isDeleted);
		return this;
	}

	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
		recordUpdated(Columns.CREATE_TIME);
	}

	public Sample letCreateTime(Date createTime) {
		setCreateTime(createTime);
		return this;
	}

	public String getCreator() {
		return this.creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
		recordUpdated(Columns.CREATOR);
	}

	public Sample letCreator(String creator) {
		setCreator(creator);
		return this;
	}

	public SampleQueryBuilder queryBuilder() {
		return new SampleQueryBuilder();
	}

	public Sample setQueryColumns(String... columnNames) {
		for (String columnName : columnNames) {
			addQueryKey(columnName);
		}
		return this;
	}

	public Sample lOrderBy() {
		orderBy();
		return this;
	}
	public Sample lOrderBy(boolean isAsc) {
		orderBy(isAsc);
		return this;
	}
	public Sample lOrderBy(String columnName) {
		orderBy(columnName);
		return this;
	}
	public Sample lOrderBy(String columnName, boolean isAsc) {
		orderBy(columnName, isAsc);
		return this;
	}
	public Sample letGetLockMode() {
		setGetLock(true);
		return this;
	}
	public Sample letReplaceMode() {
		setReplaceMode(true);
		return this;
	}
	public class SampleQueryBuilder implements java.io.Serializable {
		public SampleQueryBuilder id() {
			Sample.this.addQueryKey(Columns.ID);
			return this;
		}

		public SampleQueryBuilder name() {
			Sample.this.addQueryKey(Columns.NAME);
			return this;
		}

		public SampleQueryBuilder description() {
			Sample.this.addQueryKey(Columns.DESCRIPTION);
			return this;
		}

		public SampleQueryBuilder isDeleted() {
			Sample.this.addQueryKey(Columns.IS_DELETED);
			return this;
		}

		public SampleQueryBuilder createTime() {
			Sample.this.addQueryKey(Columns.CREATE_TIME);
			return this;
		}

		public SampleQueryBuilder creator() {
			Sample.this.addQueryKey(Columns.CREATOR);
			return this;
		}

		public Sample finishBuilder() {
			return Sample.this;
		}

	}

	public interface Columns {

		String ID = "ID";

		String NAME = "NAME";

		String DESCRIPTION = "DESCRIPTION";

		String IS_DELETED = "IS_DELETED";

		String CREATE_TIME = "CREATE_TIME";

		String CREATOR = "CREATOR";

	}
}